var parentVue = new Vue({
  el: "#effectStatistics",
  data: {
    loading: false,
    ctx: ctx,
    curHeight: (document.documentElement.clientHeight || document.body.clientHeight),//当前屏幕高度
    banjianLoading: false,
    banjianList: [], // 办件列表
    dicContents: {}, // 数据字典数据
    categoryType: [
      {
        label: '用水报装',
        name: '01',
        value: 0,
      },
      {
        label: '用电报装',
        name: '02',
        value: 0,
      },
      {
        label: '用气报装',
        name: '03',
        value: 0,
      },
      {
        label: '通信报装',
        name: '04',
        value: 0,
      },
    ], // 报装类型数据
    applyStates: [
      {
        label: '0',
        name: '已接件',
      },
      {
        label: '1',
        name: '受理中',
      },
      {
        label: '2',
        name: '已受理',
      },
      {
        label: '3',
        name: '待补全',
      },
      {
        label: '4',
        name: '已补全',
      },
      {
        label: '5',
        name: '不予受理',
      },
      {
        label: '6',
        name: '已办结',
      },
      {
        label: '14',
        name: '撤件办结',
      },
      {
        label: '15',
        name: '待复验',
      },
      {
        label: '16',
        name: '已退件',
      },
      {
        label: '17',
        name: '待整改',
      },
      {
        label: '18',
        name: '申报退件',
      },
    ], // 办理状态
    value1: '',
    hasOutLine: '1', // 市政是否存在外线工程 1 存在  0 不存在
    activeName: 'szbz',
    activeName2: 'szbz',
    dateRange: [],
    tableData: [],
    staticData: {
      jointAllCount: 10,
      waterAllCount: 10,
      electricAllCount: 20,
      gasAllCount: 13
    }, // 饼图数据
    approveActive: '1',
    autoXAxis: [], // 主动服务横坐标
    indicator: {}, // 主动服务数据统计
    unitServes: [], // 主动服务下单位服务数据
    totalLoading: false, // 头部模块的加载效果
    eaProjTotalVo: {}, // 头部【项目总数】模块的数据
    eabzTotalVo: {}, // 头部【报装件总数】模块的数据
    eabzbjTotalVo: {}, // 头部【报装办结率】模块的数据
    eawxjbTotalVo: {}, // 头部【外线接驳申报总数】模块的数据
    spanTimes: [], // 头部【水、电、气 、 通信】模块的数据
    summury: {}, // 市政报装概况series数据
    months: [], // 市政报装概况X轴数据
    overRate: {}, // 头部【平均逾期率】模块的数据
    analysisLoading: false,// 各类型申报统计加载效果
    bzRegionTotalVos: [], // 各类型申报统计-市政服务报装的表格数据
    lhbzTotalVo: [], // 各类型申报统计-市政服务报装的联合报装统计
    dxbzTotalVo: [], // 各类型申报统计-市政服务报装的单项报装统计
    szbzTypeVos: [], // 各类型申报统计-市政服务报装的饼图数据
    szbzTotal: 0, // 各类型申报统计-市政服务报装的饼图总数
    wxgcRegionTotalVos: [], // 各类型申报统计-外线工程的表格数据
    wxgcTypeVos: [], // 各类型申报统计-外线工程的饼图数据
    wxgcTotal: 0, // 各类型申报统计-外线工程的饼图总数
    startTime: '', // 开始时间yyyy-MM-dd HH:mm:ss
    endTime: '', // 结束时间
    lineChartData: [], // 主动服务线性图数据
    categoryTypes: {
      '01': {
        name: '供水服务'
      },
      '02': {
        name: '供电服务'
      },
      '03': {
        name: '供气服务'
      },
    },
    unitType: {
      '通信': {
        value: [],
        categoryType: '04',
        color: "#5AD8A6",
        name: '通信报装'
      },
      '燃气': {
        value: [],
        categoryType: '03',
        color: "#FF7368",
        name: '供气报装'
      },
      '用电': {
        value: [],
        categoryType: '02',
        color: "#FBC953",
        name: '供电报装'
      },
      '用水': {
        value: [],
        categoryType: '01',
        color: "#179BFF",
        name: '供水报装'
      },
    },
    dateActive: 'all', // 时间切换类型
    activeCategory: '01', // 各公司平均审批用时当前分类
    activeCategoryIndex: '0',
    approveInfo: {}, // 审批情况
    approveInfoLoading: false,
    xAxisBar: [],
    dicRegions: [], // 区域下拉框数据
    dicRegionFirst: {}, // 第一个城市
    searchForm: {
      daterange: [],
      itemCategoryTypes: [],
      regions: ['all'],
      keyword: '',
      curRegion: '全部',
      regionNames: [],
      pageNum: 1,
      pageSize: 5
    },
    listCivicismApplyData: [],
    total: 0,
    search: {
      categoryTypes: [],
      applyStates: [],
      keyword: '',
      pagination: {
        page: 1,
        pages: 1,
        perpage: 5
      },
    },
    unitApprove: {},
  },
  created: function () {
    this.getListBscDicRegion();
    this.getDicContents();
  },
  mounted: function () {
    this.changeDate('all');
  },
  methods: {
    getListBscDicRegion: function () {
      var ts = this
      request('', {
        type: 'get',
        url: ctx + 'rest/conditional/query/listBscDicRegion'
      }, function (res) {
        if (res.success) {
          if (res.content && res.content.length) {
            ts.dicRegionFirst = res.content[0]
            ts.dicRegions = res.content[0].children.map(function (item) {
              ts.$set(item, 'isCheck', false)
              return item
            })
            ts.dicRegions.unshift({
              regionId: 'all',
              regionName: '全部',
              isCheck: true
            })
            ts.dicRegions.push({
              regionId: ts.dicRegionFirst.regionId,
              regionName: '市区',
              isCheck: false
            })
          }
        }
      }, function (err) {

      })
    },
    // 刷新数据
    freshFn: function () {
      this.getbanjianStatistic()
      // 市政报装列表
      this.getlistCivicismApply();
    },
    // 申报数据
    getbanjianStatistic: function () {
      var ts = this,
        params = {};
      if (ts.period) {
        params = {
          period: ts.period
        }
      } else {
        params = {
          startDate: ts.startTime,
          endDate: ts.endTime,
        }
      }
      if (ts.searchForm.regions && ts.searchForm.regions.length > 0 && !(ts.searchForm.regions.indexOf('all') > -1)) {
        // params.regionIds =  JSON.stringify(ts.searchForm.regions);
        params.regionIds = ts.searchForm.regions.join(',');
      }
      ts.banjianLoading = true;
      request('', {
        type: 'get',
        url: ctx + 'civicism/statistics/banjian',
        data: params,
      }, function (res) {
        if (res.success && res.content) {
          ts.unitApprove = [];
          ts.banjianList = res.content.banjianList || [];
          var unitApprove = res.content['unit_approve'] || {};
          var months = res.content.months || [];
          var sourceTrendUnionRate = res.content['sourceTrend-unionRate']; // 联合报装率
          var sourceTrendNetRate = res.content['sourceTrend-netRate']; // 网上报装率
          var sourceTrendSingleNum = res.content['sourceTrend-singleNum'];  // 单项申报数量
          var sourceTrendNetNum = res.content['sourceTrend-netNum']; // 网上申报数量
          var sourceTrendUnionNum = res.content['sourceTrend-unionNum']; // 联合申报数据
          var sourceTrendWinNum = res.content['sourceTrend-winNum']; // 窗口申报数量
          var unitOutlineApply = res.content['unit_outline_apply'];
          var unitOutlineApplySum = res.content['unit_outline_apply_sum'];
          ts.hanleUnitApprove(unitApprove);
          ts.initGeneralSituation(months, sourceTrendUnionRate, sourceTrendNetRate,sourceTrendUnionNum, sourceTrendSingleNum,sourceTrendNetNum,sourceTrendWinNum);
          ts.initOutLineBarEchart(unitOutlineApply);
          ts.initOutlinePieEchart(unitOutlineApplySum);
        }
        ts.banjianLoading = false
      }, function (err) {
        ts.banjianLoading = false
      })
    },
    // 处理报装办件情况数据
    hanleUnitApprove: function (unitApprove) {
      var ts = this;
      for (var unitApproveKey in unitApprove) {
        var unitObj = ts.unitType[unitApproveKey];
        unitObj.value = unitApprove[unitApproveKey];
        var allTotal = 0;
        for (var i = 0; i < unitApprove[unitApproveKey].length; i++) {
          allTotal = allTotal + unitApprove[unitApproveKey][i].total;
        }
        console.log(allTotal)
        unitObj.allTotal = allTotal;
        ts.unitApprove.push(unitObj)
      }
      console.log(ts.unitApprove)
    },
    // 获取市政报装table表格数据
    getlistCivicismApply: function () {
      var ts = this,
        params = JSON.parse(JSON.stringify(ts.search));
      if (params.categoryTypes && params.categoryTypes.length > 0) {
        params.categoryTypes = params.categoryTypes.join(",");
      } else {
        delete params.categoryTypes
      }
      if (ts.search.applyStates && params.applyStates.length > 0) {
        params.applyStates = params.applyStates.join(",");
      } else {
        delete params.applyStates
      }
      if (ts.period) {
        params.period = ts.period;
      } else {
        params.startDate = ts.startTime;
        params.endDate = ts.endTime;
      }
      if (ts.searchForm.regions && ts.searchForm.regions.length > 0 && !(ts.searchForm.regions.indexOf('all') > -1)) {
        params.regionIds = ts.searchForm.region.join(",");
      }
      ts.banjianLoading = true;
      request('', {
        type: 'get',
        url: ctx + 'civicism/statistics/listCivicismApply',
        data: params,
      }, function (res) {
        if (res.success && res.content) {
          ts.listCivicismApplyData = res.content.list || [];
          ts.total = res.content.total;
        }
        ts.banjianLoading = false
      }, function (err) {
        ts.banjianLoading = false
      })
    },
    // 查看
    toDetail: function (row) {
      var ts = this;
      var taskId = row.taskId;
      var viewId = row.viewId || '39e32f68-0e67-4c5a-abc3-6cd9f8a1b908';
      var url = ctx + "apanmis/page/stageApproveIndex?isNotCompareAssignee=true&observer=true&taskId=" + taskId + "&viewId=" + viewId;
      if (taskId) {
        var tempwindow = window.open(); // 先打开页面
        setTimeout(function () {
          tempwindow.location = url
        }, 0)
      } else {
        ts.$message('请确保拿到taskId,不能为空');
      }
    },
    // 催办
    sendRemind: function (row) {
      var ts = this;
      if (!row.loading) {
        ts.$set(row, 'loading', true);
      }
      var taskId = row.taskId;
      var procinstId = row.procinstId
      var applyinstId = row.applyinstId;
      var viewId = row.viewId || "cc06641e-f6e6-4dd7-bcc7-591e23080c6a"
      var url = ctx + "apanmis/page/municipalSupervisionDetail.html?isNotCompareAssignee=true&taskId=" + taskId + "&applyinstId=" + applyinstId + "&isUrge=true&procInstId=" + procinstId + "&viewId=" + viewId;
      if (taskId && applyinstId) {
        ts.$set(row, 'loading', false);
        var tempwindow = window.open(); // 先打开页面
        setTimeout(function () {
          tempwindow.location = url
        }, 0)
      } else {
        ts.$set(row, 'loading', false);
        ts.$message('请确保拿到taskId、applyinstId,不能为空');
      }
      /* var urgeInfo  = [];
       urgeInfo.push(row)
       request('', {
           type: 'post',
           url: ctx + 'bpm/front/remind/civicism/urgeMsg/save',
           data:{
               urgeInfo:JSON.stringify(urgeInfo)
           }
       }, function (res) {
           ts.$set(row,'loading',false);
           if (res.success) {
               ts.$message.success(res.message||'发送催办消息成功')
           } else {
               ts.$message.error( res.message||'发送催办消息失败')
           }
       }, function (err) {
           ts.$set(row,'loading',false);
           ts.$message.error('发送催办消息失败')
       })*/
    },
    // 初始申报化渠道趋势echart
    initGeneralSituation: function (months, sourceTrendUnionRate, sourceTrendNetRate,sourceTrendUnionNum, sourceTrendSingleNum,sourceTrendNetNum,sourceTrendWinNum) {
      var ts = this;
      var chartDom = document.getElementById('apply-trend-echart');
      var myChart = echarts.init(chartDom);
      var option;
      option = {
        title: {
          text: '申报化渠道趋势',
          padding: [15, 0, 0, 15],
          textStyle: {
            color: '#575962', //颜色

            fontStyle: 'normal', //风格

            fontWeight: 'normal', //粗细

            fontFamily: 'PingFangSC', //字体

            fontSize: 16, //大小
          },
        },
        tooltip: {
          trigger: 'axis',
          formatter: function(params) {
            console.log(params)
            var nameArry = params[0].name.split('-');
            var time = nameArry[0] +'年' + nameArry[1] + '月'
            var res = '';
            res += '<div class="custom-tooltip">\n' +
                '<div class="time">'+ time +'</div>\n'
            for (var i = 0, l = params.length; i < l; i++) {
              if(i == 0){
                res += '<div class="list">\n' +
                    '<div class="item">\n' +
                    '\t\t\t\t\t<p class="p">\n' +
                    '\t\t\t\t\t\t<span class="circle"></span>\n' +
                    '\t\t\t\t\t\t<span class="text">' + params[i].seriesName +'</span>\n' +
                    '\t\t\t\t\t</p>\n' +
                    '\t\t\t\t\t<p class="p num">' + params[i].value +'%</p>\n' +
                    '\t\t\t\t</div>\n' +
                    '\t\t\t\t<div class="item mt4">\n' +
                    '\t\t\t\t\t<p class="p color-575962">\n' +
                    '\t\t\t\t\t\t<span class="text-1">联合报装'+sourceTrendUnionNum[params[i].dataIndex]+'</span>\n' +
                    '\t\t\t\t\t</p>\n' +
                    '\t\t\t\t\t<p class="p color-575962 fr">\n' +
                    '\t\t\t\t\t\t单项报装'+sourceTrendSingleNum[params[i].dataIndex]+'\n' +
                    '\t\t\t\t\t</p>\n' +
                    '\t\t\t\t</div>\n' +
                    '\t\t\t</div>'
              }else{
                res += '<div class="list">\n' +
                    '\t\t\t\t<div class="item">\n' +
                    '\t\t\t\t\t<p class="p">\n' +
                    '\t\t\t\t\t\t<span class="circle-1"></span>\n' +
                    '\t\t\t\t\t\t<span class="text">' + params[i].seriesName +'</span>\n' +
                    '\t\t\t\t\t</p>\n' +
                    '\t\t\t\t\t<p class="p num">' + params[i].value +'%</p>\n' +
                    '\t\t\t\t</div>\n' +
                    '\t\t\t\t<div class="item mt4">\n' +
                    '\t\t\t\t\t<p class="p color-575962">\n' +
                    '\t\t\t\t\t\t<span class="text-1">网上报装'+sourceTrendNetNum[params[i].dataIndex]+'</span>\n' +
                    '\t\t\t\t\t</p>\n' +
                    '\t\t\t\t\t<p class="p color-575962 fr">\n' +
                    '\t\t\t\t\t窗口报装'+sourceTrendWinNum[params[i].dataIndex]+'\n' +
                    '\t\t\t\t\t</p>\n' +
                    '\t\t\t\t</div>\n' +
                    '\t\t\t</div>'
              }
            }
           /* var res = '<div style="width: 200px;">' + params[0].name + '<br>';
            for (var i = 0, l = params.length; i < l; i++) {
              if(i == 0){
                res += '<div style="width: 100%;"><p style="display:inline-block;width: 4px;\n' +
                    'height: 4px;\n' +
                    'background: #5b8ff9;\n' +
                    'border-radius: 50%;"></p>'
                res += '<span>' + params[i].seriesName + '</span><span style="text-align: right;"> ' + params[i].value + '</span></div>' +
                        '<div>' +
                          '<span>联合报装56</span> ' +
                          '<span>单项报装44</span> ' +
                        '</div>'
              }else{
                res += '<div style="width: 100%;"><p style="display:inline-block;width: 4px;\n' +
                    'height: 4px;\n' +
                    'background: #e86452;\n' +
                    'border-radius: 50%;"></p>'
                res += '<span>' + params[i].seriesName + '</span><span style="text-align: right;"> ' + params[i].value + '</span></div>' +
                      '<div>' +
                        '<span>网上报装37</span> ' +
                        '<span>窗口报装128</span> ' +
                      '</div>'
              }
            }*/
            res += '</div>'
            return res;
          }
        },
        color: ['#179BFF', '#E56F62'],
        legend: {
          x: 'left',
          padding: [12, 0, 0, 150],
          itemWidth: 10,
          itemHeight: 10,
          data: [
            {
              name: '联合报装率',
              textStyle: {
                fontSize: 14,
                fontWeight: '400',
                color: '#575962'
              },
              icon: 'circle'
            },
            {
              name: '网上报装率',
              textStyle: {
                fontSize: 14,
                fontWeight: '400',
                color: '#575962'
              },
              icon: 'circle'
            }
          ]
        },
        grid: {
          left: '3%',
          right: '4%',
          bottom: '3%',
          containLabel: true
        },
        toolbox: {
          show: false,
        },
        xAxis: {
          type: 'category',
          data: months,
          axisLine: {
            show: false,
          },
        },
        yAxis: {
          type: 'value',
          axisTick: {
            //刻度线
            show: false
          },
          axisLine: {
            show: false,
          },
          splitLine:{//分割线
            show:true,
            lineStyle: {
              type:'dashed',
              color: "rgba(223,224,226,1)",
            }
          }
        },
        series: [{
          name: '联合报装率',
          areaStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(
                  0,
                  0,
                  0,
                  1,
                  [{
                    offset: 0,
                    color: "rgba(23,155,255,.14)"
                  },
                    {
                      offset: 1,
                      color: "rgba(222,241,255,0.14)"
                    }
                  ],
                  false
              ),
            }
          },
          data: sourceTrendUnionRate,
          type: 'line',
          smooth: true
        }, {
          name: '网上报装率',
          areaStyle: {// 橙红深
            normal: {
              color: new echarts.graphic.LinearGradient(
                  0,
                  0,
                  0,
                  1,
                  [{
                    offset: 0,
                    color: "rgba(255,146,95,0.11)"
                  },
                    {
                      offset: 1,
                      color: "rgba(255,243,238,0.11)"
                    }
                  ],
                  false
              ),
            }
          },
          data: sourceTrendNetRate,
          type: 'line',
          smooth: true
        }
        ]
      };
      // 自适应图表
      window.addEventListener('resize',function(){
        myChart.resize();
      })
      option && myChart.setOption(option);
    },
    // 初始外线工程申报echart
    initOutLineBarEchart: function (unitOutlineApply) {
      // 基于准备好的dom，初始化echarts实例
      var ts = this;
      var chartDom = document.getElementById('outline-apply-bar-echart');
      var myChart = echarts.init(chartDom);
      var option;
      var xAxisData = [];
      var seriesData1 = []
      var seriesData2 = []
      var seriesData3 = []
      unitOutlineApply.forEach(function (item) {
        xAxisData.push(item.applicant);
        seriesData1.push(item.applyNum);
        seriesData2.push(item.associateProjNum);
        seriesData3.push(item.unAssociateProjNum);
      });
      option = {
        //画布背景色设置
        backgroundColor: "#ffffff",
        title: {
          text: '外线工程申报',
          padding: [15, 0, 0, 15],
          textStyle: {
            color: '#575962', //颜色

            fontStyle: 'normal', //风格

            fontWeight: 'normal', //粗细

            fontFamily: 'PingFangSC', //字体

            fontSize: 16, //大小
          },
        },
        tooltip: {
          trigger: "axis"
        },
        color: ['#169AFF', '#F6BD16', '#8292AF'],
        legend: {
          x: 'left',
          padding: [15, 0, 0, 150],
          itemWidth: 10,
          itemHeight: 10,
          data: [
            {
              name: '外线工程申报总数',
              textStyle: {
                fontSize: 14,
                fontWeight: '400',
                color: '#575962'
              },
              icon: 'circle'
            },
            {
              name: '关联红线内项目',
              textStyle: {
                fontSize: 14,
                fontWeight: '400',
                color: '#575962'
              },
              icon: 'circle'
            },
            {
              name: '未关联红线内项目',
              textStyle: {
                fontSize: 14,
                fontWeight: '400',
                color: '#575962'
              },
              icon: 'circle'
            }
          ]
        },
        toolbox: {
          show: false,
        },
        calculable: true,
        xAxis: [
          {
            type: "category",
            axisTick: {
              //刻度线
              show: false
            },
            data: xAxisData,
          }
        ],
        yAxis: [
          {
            type: "value",
            axisLine: {
              //y轴
              show: false
            },
            axisTick: {
              //刻度线
              show: false
            },
            splitLine: {
              //网格线
              show: true
            }
          }
        ],
        series: [
          {
            name: "外线工程申报总数",
            type: "bar",
            //设置柱状图宽度
            barWidth: "14",
            //柱状图间距
            barGap: "100%",
            data: seriesData1,
            itemStyle: {
              normal: {
                // 统一设置四个角的圆角大小
                barBorderRadius: 7,
                //设置柱状图颜色渐变
                color: "#169AFF"
              }
            }
          },
          {
            name: "关联红线内项目",
            type: "bar",
            //设置柱状图宽度
            barWidth: "14",
            //柱状图间距
            barGap: "100%",
            data: seriesData2,
            itemStyle: {
              normal: {
                // 统一设置四个角的圆角大小
                barBorderRadius: 7,
                //设置柱状图颜色渐变
                color: "#FBC953"
              }
            }
          },
          {
            name: "未关联红线内项目",
            type: "bar",
            //设置柱状图宽度
            barWidth: "14",
            //柱状图间距
            barGap: "100%",
            data: seriesData3,
            itemStyle: {
              normal: {
                // 统一设置四个角的圆角大小
                barBorderRadius: 7,
                //设置柱状图颜色渐变
                color: "#8292AF"
              }
            }
          },
        ]
      };
      option && myChart.setOption(option);
    },
    initOutlinePieEchart: function (unitOutlineApplySum) {
      // 基于准备好的dom，初始化echarts实例
      var ts = this;
      var chartDom = document.getElementById('outline-apply-pie-echart');
      var myChart = echarts.init(chartDom);
      var option;
      option = {
        tooltip: {
          trigger: 'item'
        },
        color: ["#8292AF", "#FBC953"],
        series: [
          {
            /*name: '报装数',*/
            type: 'pie',
            radius: '48%',
            data: [
              {value: unitOutlineApplySum.singleLineNum, name: '未关联红线内\n 项目'},
              {value: unitOutlineApplySum.outLineNum, name: '关联红线内\n 项目'},
            ],
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: 'rgba(0, 0, 0, 0.5)'
              }
            }
          }
        ]
      };
      option && myChart.setOption(option);
    },
    handleSizeChange: function (size) {
      var _that = this;
      _that.search.pagination.perpage = size;
      _that.getlistCivicismApply();
    },
    handleCurrentChange: function (value) {
      var _that = this;
      _that.search.pagination.page = value;
      _that.search.pagination.pages = value;
      _that.getlistCivicismApply();
    },
    // 自定义表格斑马纹
    tableRowClassName: function (obj) {
      if (obj.rowIndex % 2 === 1) {
        return 'bg-row';
      }
    },
    // 获取数据字典
    getDicContents: function () {
      var ts = this;
      request('', {
          url: ctx + 'rest/common/getDicContents',
          type: 'get',
        }, function (res) {
          if (res.success) {
            ts.dicContents = res.content;
            ts.applyStates = ts.dicContents['APPLYINST_STATE'];
          }
        },
        function (err) {

        })
    },
    // 办理状态文本
    formatMyStatus: function (val) {
      var ts = this;
      var str = '';
      ts.dicContents['APPLYINST_STATE'].forEach(function (item) {
        if (item.itemCode == val) {
          str = item.itemName
        }
      })
      return str
    },
    // 办理状态颜色值
    applyinstStateColor: function (val) {
      if (val == 0) return "#169aff";
      if (val == 1) return "#169aff";
      if (val == 2) return "#26bd7f";
      if (val == 3) return "#ff8915";
      if (val == 4) return "#ff8915";
      if (val == 5) return "#FF4B47";
      if (val == 6) return "#26bd7f";
      if (val == 7) return "#ff8915";
      if (val == 8) return "#ff8915";
      if (val == 9) return "#ff8915";
      if (val == 10) return "#ff8915";
      if (val == 11) return "#ff8915";
      if (val == 12) return "#727475";
      if (val == 13) return "#727475";
      if (val == 14) return "#727475";
      if (val == 15) return "#ff8915";
      if (val == 16) return "#727475";
      return "#000";
    },
    // 切换时间
    changeDate: function (type, key) {
      this.dateActive = type
      if (type === 'dateRange') {
        this.period = '';
        if (this.startTime && this.endTime) {
          if (this.startTime > this.endTime) {
            this.$message({
              type: 'error',
              message: '开始时间不能大于结束时间！'
            })
            return
          }
          this.freshFn()
        } else {
          // 清除时间时
          if (key === 'endTime' && !this.endTime) {
            this.dateActive = 'all'
            this.startTime = ''
            this.freshFn()
          }
        }
        return;
      }
      var nowDate = new Date()
      var month = nowDate.getMonth();
      this.endTime = formatDate(nowDate, 'yyyy-MM-dd')
      if (type === 'month') {
        nowDate.setDate(1)
      } else if (type === 'quarter') {
        if (month < 3) {
          nowDate.setMonth(0);
        } else if (2 < month && month < 6) {
          nowDate.setMonth(3);
        } else if (5 < month && month < 9) {
          nowDate.setMonth(6);
        } else if (8 < month && month < 11) {
          nowDate.setMonth(9);
        }
        nowDate.setDate(1)
      } else if (type === 'year') {
        nowDate.setDate(1);
        nowDate.setMonth(0);
      }
      this.startTime = formatDate(nowDate, 'yyyy-MM-dd')
      if (type === 'all') {
        this.startTime = ''
        this.endTime = ''
      } else {
        this.startTime = this.startTime
      }
      this.freshFn()
    },
    // 区域切换
    handleCommand: function (command) {
      console.log(command)
      if (command.regionName !== '全部' && this.dicRegions[0].isCheck) {
        this.$set(this.dicRegions[0], 'isCheck', false)
      }
      command.isCheck = !command.isCheck
      if (this.isMultiple && command.isCheck) {
        this.searchForm.push(command.regionName)
        this.searchForm.regions.push(command.regionId)
        this.searchForm.curRegion = this.searchForm.regionNames.join(',')
      } else {
        this.searchForm.regions = [command.regionId]
        this.searchForm.curRegion = command.regionName
      }
      this.freshFn()
    },
    // 自定义控制条颜色
    customColorMethod: function (item) {
      switch (item.categoryType) {
        case '01':
          return '#179BFF';
          break;
        case '02':
          return '#FBC953';
          break;
        case '03':
          return '#FF7368';
          break;
        default:
          return '#5AD8A6';
      }
    },
    // 重置搜索
    resetSearch: function () {
      this.search = {
        categoryTypes: [],
        applyStates: [],
        keyword: '',
        pagination: {
          page: 1,
          pages: 1,
          perpage: 5
        },
      };
      this.getlistCivicismApply();
    },
    resetPagination: function () {
      this.search.pagination = {
        page: 1,
        pages: 1,
        perpage: 5
      };
      this.getlistCivicismApply();
    },
  },
})